package edu.webtek.clouddata;

import org.jdom2.Element;

public class Shop {
	final private int    shopID;
	final private String shopName;
	final private String shopURL;
	
	public Shop(Element shop) {
		super();
		String shopName = "NULL", shopURL = "NULL";
		int shopID = -1;
		for(Element attr : shop.getChildren()){
			switch(attr.getName()){
			case "shopID":
				shopID = Integer.parseInt(attr.getText());
				break;
			case "shopName":
				shopName = attr.getText();
				break;
			case "shopURL":
				shopURL = attr.getText();
				break;
			}
		}
		this.shopID   = shopID;
		this.shopName = shopName;
		this.shopURL  = shopURL;
	}
	
	public int getShopID() {
		return shopID;
	}
	public String getShopName() {
		return shopName;
	}
	public String getShopURL() {
		return shopURL;
	}

	@Override
	public String toString() {
		return "Shop [shopID=" + shopID + ", shopName=" + shopName
				+ ", shopURL=" + "<a href=" + shopURL + "> URL </a>]";
	}
	
	
}